/******************************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Ltd.                       */
/*                                                                            */
/*  NAME      = fix_fast.c                                                    */
/*  NOTE      = FAST字段解压                                                  */
/*  DATE      = 2015/03/19 by zhengxd                                         */
/******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>

#include "fix_core.h"
#include "fix_comm.h"
#include "fix_fast.h"


/* 深交所格式: ID 域名称 必须 操作符 占位 类型 默认值 */
/* 深圳行情频道心跳（行情系统下发） */
char arr_ua001[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "10201 ChannelNo Y none N uInt32",
    "1350 ApplLastSeqNum Y none N Int64",
    "10205 EndOfChannel N none N string",
};

/* 深圳行情重传请求 */
char arr_ua002[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "10077 ResendType Y none N uInt32",
    "10201 ChannelNo Y none N uInt32",
    "1182 ApplBegSeqNum N none N Int64",
    "1183 ApplEndSeqNum N none N Int64",
    "1472 NewsID N none N string",
    "10076 ResendStatus N none N uInt32",
    "58 Text N none N string",
};

/* 深圳行情信息商上报用户信息给行情系统 */
char arr_ua003[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "42 OrigTime Y none N Int64",
    "8934 VersionCode Y none N string",
    "8935 UserNum Y none N uInt32",
};

/* 深圳行情行情系统下发行情频道统计 */
char arr_ua004[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "42 OrigTime Y delta N Int64",
    "10201 ChannelNo Y none N uInt32",
    "10208 NoMDStreamID Y none N uInt32",
    "1500 MDStreamID Y copy Y String",//
    "10207 StockNum N none N uInt32",
    "8538 TradingPhaseCode Y copy Y String",
};

/* 深圳行情行情系统拒绝VSS重传或者用户信息报告 */
char arr_j[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "45 RefSeqNum N none N Int64",
    "372 RefMsgType Y none N String",
    "379 BusinessRejectRefID N none N String",
    "380 BusinessRejectReason Y none N uInt32",
    "58 Text N none N string",
};

/* 深圳行情行情系统下发证券实时状态 */
char arr_f[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "42 OrigTime Y delta N Int64",
    "10201 ChannelNo Y copy Y uInt32",
    "48 SecurityID Y none N string",
    "22 SecurityIDSource Y none N string",
    "291 FinancialStatus N none N string",
    "10202 NoSwitch N none N uInt32",
    "10203 SecuritySwitchType Y none N uInt32",
    "10204 SecuritySwitchStatus Y none N string",
};

/* 深圳行情行情系统下发公告 */
char arr_B[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "42 OrigTime N none N Int64",
    "10201 ChannelNo Y copy Y uInt32",
    "1472 NewsID N none N string",
    "148 HeadLine Y none N string",
    "10209 RawDataFormat Y none N string",
    "95 RawDataLength Y none N uInt64", //todo
    "96 RawData Y none N string",  //96表示的长度
};


/* 深圳行情行情系统下发快照行情 */
char arr_W[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "42 OrigTime Y delta N Int64",
    "10201 ChannelNo Y copy Y uInt32",
    "1500 MDstreamIC Y copy Y string",
    "48 SecurityID Y none N string",
    "22 SecurityIDSource Y none N string",
    "8538 TradingPhaseCode Y copy Y string",
    "140 PreClosePx Y none N Int64",
    "8503 NumTrades Y none N Int64",
    "387 TotalVolumeTrade Y none N Int64",
    "8504 TotalValueTrade Y none N Int64",
    "10207 StockNum N none N uInt32",
    "268 NoMDentries N none N uInt32",
    "269 MDEntryType Y none N string",
    "270 MDEntryPx N none N Int64",
    "271 MDEntrySize N none N Int64",
    "1023 MDPriceLevel N none N uInt32",
    "346 NumberOfOrders N none N Int64",
    "73 NoOrders N none N uInt32",
    "38 OrderQty N none N Int64",
};

/* 深圳行情行情系统下发逐笔委托行情 */
char arr_ua201[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "10201 ChannelNo Y copy Y uInt32",
    "1181 ApplSeqNum Y increment Y string",
    "1500 MDStreamID Y copy Y String",
    "48 SecurityID Y none N string",
    "22 SecurityIDSource Y none N string",
    "44 Price Y none N Int64",
    "38 OrderQty Y none N Int64",
    "54 Side Y none N string",
    "40 OrdType N none N string",
    "664 ConfirmID N none N string",
    "8911 ExpirationDays N none N uInt32",
    "8906 ExpirationType N none N uInt32",
    "60 TransactTime Y delta N Int64",
    "10184 Contactor N none N string",
    "10185 ContactInfo N none N string",
};

/* 深圳行情行情系统下发逐笔成交行情 */
char arr_ua202[][128] =
{
    "999 TemplateID Y default Y uInt32",
    "10201 ChannelNo Y copy Y uInt32",
    "1181 ApplSeqNum Y increment Y string",
    "1500 MDStreamID Y copy Y String",
    "10116 BidApplSeqNum N none N Int64",
    "10117 OfferApplSeqNum N none N Int64",
    "48 SecurityID Y none N string",
    "22 SecurityIDSource Y none N string",
    "31 LastPx N none N Int64",
    "32 LastQty Y none N Int64",
    "150 ExecType Y none N string",
    "60 Transactime Y delta N Int64",
};

/* 上交所格式: ID 域名称 必须 操作符 类型 默认值 */
char arr_ua3201[][128] =
{
    "999 TemplateID Y Copy Int32",
    "35 MessageType Y constant string",
    "10121 DataStatus N Default Int32",
    "10011 TradeIndex Y increment Int32",
    "10115 TradeChannel Y Copy Int32",
    "48 SecurityID N Copy string",
    "10013 TradeTime N Copy Int32",
    "10014 TradePrice N Default Int32",
    "10015 TradeQty N Default Int32",
    "10016 TradeMoney N Default Int64",
};


char arr_ua3202[][128] =
{
    "999 TemplateID Y copy Int32",
    "35 MessageType Y constant string",
    "10178 DataTimeStamp Y copy Int32",
    "10121 DataStatus N default Int32",
    "48 SecurityID Y none string",
    "10146 ImageStatus Y copy Int32",
    "140 PreClosePx N default Int32",
    "10018 OpenPx N default Int32",
    "332 HighPx N default Int32",
    "333 LowPx N default Int32",
    "31 LastPx N default Int32",
    "10204 ClosePx N default Int32",
    "10135 InstrumentStatus N default string",
    "8503 NumTrades N default Int32",
    "387 TotalVolumeTrade N default Int64",
    "8504 TotalValueTrade N default Int64",
    "10043 TotalBidQty N default Int64",
    "10039 WeightedAvgBidPx N default Int32",
    "10116 AltWeightedAvgBidPx N default Int32",
    "10044 TotalOfferQty N default Int64",
    "10040 WeightedAvgOfferPx N default Int32",
    "10117 AltWeightedAvgOfferPx N default Int32",
    "10057 IOPV N default Int32",
    "10060 YieldToMaturity N default Int32",
    "10138 TotalWarrantExecQty N default Int64",
    "10139 WarLowerPx N default Int64",
    "10140 WarUpperPx N default Int64",
    "10068 NoBidLevel N none Int32",
    "10147 PriceLevelOperator N default Int32",
    "44 Price Y none Int32",
    "39 OrderQty Y default Int32",
    "10067 NumOrders Y default Int32",
    "73 NoOrders N default Int32",
    "10148 OrderQueueOperator N default Int32",
    "10149 OrderQueueOperatorEntryID N default Int32",
    "38 OrderQty N default Int64",
    "10069 NoOfferLevel N none Int32",
    "10147 PriceLevelOperator N default Int32",
    "44 Price Y none Int32",
    "39 OrderQty Y default Int32",
    "10067 NumOrders Y default Int32",
    "73 NoOrders N default Int32",
    "10148 OrderQueueOperator N default Int32",
    "10149 OrderQueueOperatorEntryID N default Int32",
    "38 OrderQty N default Int64",
};

char arr_ua3107[][128] =
{
    "999 TemplateID Y copy Int32",
    "35 MessageType Y constant string",
    "10178 DataTimeStamp Y copy Int32",
    "10121 DataStatus N default Int32",
    "48 SecurityID Y none string",
    "44 Price Y none Int32",
    "10127 VirtualAuctionQty Y none Int32",
    "151 LeaveQty Y none Int32",
    "54 Side Y none string",
};

char arr_ua3113[][128] =
{
    "999 TemplateID Y copy Int32",
    "35 MessageType Y constant string",
    "10178 DataTimeStamp Y copy Int32",
    "10121 DataStatus N default Int32",
    "48 SecurityID Y none string",
    "10007 PreCloseIndex N default Int64",
    "10006 OpenIndex N default Int64",
    "10118 Turnover N default Int64",
    "10009 HighIndex N default Int64",
    "10010 LowIndex N default Int64",
    "10008 LastIndex N default Int64",
    "10204 CloseIndex N default Int64",
    "10013 TradeTime N default Int32",
    "387 TotalVolumeTraded N default Int64",
};

char arr_ua3115[][128] =
{
    "999 TemplateID Y copy Int32",
    "35 MessageType Y constant string",
    "10178 DataTimeStamp Y copy Int32",
    "10121 DataStatus N default Int32",
    "48 SecurityID N default string",
    "42 OrigTime N default Int32",
    "10003 OrigDate N default Int32",
};

/*******************************************************************************
*  FUNC     :  重置前值
*  ARGS     :  p_st_fast (fast描述)
*           :  p_curr_value (当前值)
*           :  ui_curr_size (当前值size)
*  RTN      :  void
*  NOTE     :
*******************************************************************************/
static void __fix_fast_reset_pre(Fix_fast_mod *p_st_fast
                                 , void *p_curr_value
                                 , unsigned int ui_curr_size)
{
    if (p_st_fast->p_pre_value)
    {
        frfree(p_st_fast->p_pre_value);
    }
    p_st_fast->p_pre_value = p_curr_value;
    p_st_fast->ui_pre_size = ui_curr_size;

    return;
}

/*******************************************************************************
*  FUNC     :  节点node free
*  ARGS     :  p_st_node
*  RTN      :  void
*  NOTE     :
*******************************************************************************/
void fix_fast_mod_node_free(Frlist_node *p_st_node)
{
    if (p_st_node == NULL || p_st_node->data == NULL)
    {
        return;
    }

    Fix_fast_mod *p_st_fast = (Fix_fast_mod *)p_st_node->data;

    if (p_st_fast->p_name)
    {
        frfree(p_st_fast->p_name);
    }
    if (p_st_fast->p_def_value)
    {
        frfree(p_st_fast->p_def_value);
    }
    if (p_st_fast->p_pre_value)
    {
        frfree(p_st_fast->p_pre_value);
    }

    if (p_st_fast->i_sub_node_flg)
    {
        frlist_remove_all(&p_st_fast->st_sub_node, fix_fast_mod_node_free);
    }

    frfree(p_st_fast);
    return;
}


/*******************************************************************************
*  FUNC     :  Fix_fast_mod free
*  ARGS     :  p_st_node
*  RTN      :  void
*  NOTE     :
*******************************************************************************/
void fix_fast_mod_free(Fix_fast_mod **pp_st_fast)
{
    if (pp_st_fast == NULL || *pp_st_fast == NULL)
    {
        return;
    }

    Fix_fast_mod *p_st_fast = *pp_st_fast;

    if (p_st_fast->p_name)
    {
        frfree(p_st_fast->p_name);
    }
    if (p_st_fast->p_def_value)
    {
        frfree(p_st_fast->p_def_value);
    }
    if (p_st_fast->p_pre_value)
    {
        frfree(p_st_fast->p_pre_value);
    }

    if (p_st_fast->i_sub_node_flg)
    {
        frlist_remove_all(&p_st_fast->st_sub_node, fix_fast_mod_node_free);
    }

    frfree(p_st_fast);
    *pp_st_fast = NULL;
    return;
}

/*******************************************************************************
*  FUNC     :  Fix_fast_mod reset
*  ARGS     :  p_st_node
*  RTN      :  void
*  NOTE     :
*******************************************************************************/
void fix_fast_mod_reset(Frlist_header *p_lst_hd)
{
    Fix_fast_mod *p_st_fast = NULL;
    Frlist_node *p_st_node = NULL;

    p_st_node = FRLIST_FIRST_NODE(p_lst_hd);
    while (p_st_node)
    {
        p_st_fast = (Fix_fast_mod *)FRLIST_GET_NODE_DATA(p_st_node);
        p_st_fast->i_pre_define = FR_NO;
        p_st_fast->ui_pre_size = 0;
        if (p_st_fast->p_pre_value)
        {
            frfree(p_st_fast->p_pre_value);
            p_st_fast->p_pre_value = NULL;
        }
        if (p_st_fast->i_sub_node_flg)
        {
            fix_fast_mod_reset(&p_st_fast->st_sub_node);
        }
        p_st_node = FRLIST_NEXT_NODE(p_st_node);
    }
    return;
}

/*******************************************************************************
*  FUNC     :  深交所fast定义初始化
*  ARGS     :  p_oneline (一行数据)
*           :  p_i_pmap (PAMP)
*           :  p_i_operator (操作费)
*           :  p_i_data_type (数据类型)
*           :  p_i_id (ID)
*           :  p_i_presence (存在)
*           :  pp_name (名称)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 占位 类型 默认值
*******************************************************************************/
int fix_fast_szse_oneline(char *p_oneline
                         , int *p_i_pmap
                         , int *p_i_operator
                         , int *p_i_data_type
                         , int *p_i_id
                         , int *p_i_presence
                         , char **pp_name)
{
    int i_id = 0;
    int i_pmap = 0;
    int i_presence = 0;
    int i_operator = 0;
    int i_data_type = 0;
    unsigned int ui_len = 0;
    char *p_tmp = NULL;
    char *p_name = NULL;
    char *p_space = NULL;

    i_id = atoi(p_oneline);
    /* skip第一个空格之前 */
    p_tmp = strchr(p_oneline, ' ');
    if (p_tmp == NULL)
    {
        return FR_FAIL;
    }
    p_tmp += 1;

    /* 取得域名城 */
    p_space = strchr(p_tmp, ' ');
    if (p_space == NULL)
    {
        return FR_FAIL;
    }
    ui_len = p_space - p_tmp;
    p_name = (char *)frmalloc(ui_len + 1);
    if (p_name == NULL)
    {
        return FR_FAIL;
    }
    snprintf(p_name, ui_len + 1, "%s", p_tmp);
    p_tmp = p_space + 1;

    /* 取得必须 */
    switch (*p_tmp)
    {
        case 'y':
        case 'Y':
            i_presence = FIX_FAST_MANDATORY;
            break;

        case 'n':
        case 'N':
            i_presence = FIX_FAST_OPIONAL;
            break;

         default:
            frfree(p_name);
            return FR_FAIL;
    }
    p_tmp++;
    if (*p_tmp != ' ')
    {
        frfree(p_name);
        return FR_FAIL;
    }
    p_tmp++;

    /* 取得操作符 */
    if (strncasecmp(p_tmp, "None ", 5) == 0)
    {
        i_operator = FIX_FAST_NONE_OPERATOR;
        p_tmp += 5;
    }
    else if (strncasecmp(p_tmp, "Constant ", 9) == 0)
    {
        i_operator = FIX_FAST_CONSTANT_OPERATOR;
        p_tmp += 9;
    }
    else if (strncasecmp(p_tmp, "Default ", 8) == 0)
    {
        i_operator = FIX_FAST_DEFAULT_OPERATOR;
        p_tmp += 8;
    }
    else if (strncasecmp(p_tmp, "Copy ", 5) == 0)
    {
        i_operator = FIX_FAST_COPY_OPERATOR;
        p_tmp += 5;
    }
    else if (strncasecmp(p_tmp, "Increment ", 10) == 0)
    {
        i_operator = FIX_FAST_INCREMENT_OPERATOR;
        p_tmp += 10;
    }
    else if (strncasecmp(p_tmp, "Delta ", 6) == 0)
    {
        i_operator = FIX_FAST_DELTA_OPERATOR;
        p_tmp += 6;
    }
    else if (strncasecmp(p_tmp, "Tail ", 6) == 0)
    {
        i_operator = FIX_FAST_TAIL_OPERATOR;
        p_tmp += 5;
    }
    else
    {
        frfree(p_name);
        return FR_FAIL;
    }

    /* 取得占位 */
    switch (*p_tmp)
    {
        case 'y':
        case 'Y':
            i_pmap = FR_YES;
            break;

        case 'n':
        case 'N':
            i_pmap = FR_NO;
            break;

         default:
            frfree(p_name);
            return FR_FAIL;
    }
    p_tmp++;
    if (*p_tmp != ' ')
    {
        frfree(p_name);
        return FR_FAIL;
    }
    p_tmp++;

    /* 取得字段类型 */
    if (strcasecmp(p_tmp, "Int32") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_INT32;
    }
    else if (strcasecmp(p_tmp, "uInt32") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_UINT32;
    }
    else if (strcasecmp(p_tmp, "Int64") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_INT64;
    }
    else if (strcasecmp(p_tmp, "uInt64") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_UINT64;
    }
    else if (strcasecmp(p_tmp, "Decimal") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_DECIMAL;
    }
    else if (strcasecmp(p_tmp, "string") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_STRING;
    }
    else if (strcasecmp(p_tmp, "Byte") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_BYTE;
    }
    else if (strcasecmp(p_tmp, "Sequence") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_SEQUENCE;
    }
    else if (strcasecmp(p_tmp, "Group") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_GROUP;
    }
    else
    {
        frfree(p_name);
        return FR_FAIL;
    }

    *p_i_operator = i_operator;
    *p_i_data_type = i_data_type;
    *p_i_id = i_id;
    *p_i_presence = i_presence;
    *pp_name = p_name;
    *p_i_pmap = i_pmap;
    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  上交所fast定义初始化
*  ARGS     :  p_oneline (一行数据)
*           :  p_i_pmap (PAMP)
*           :  p_i_operator (操作费)
*           :  p_i_data_type (数据类型)
*           :  p_i_id (ID)
*           :  p_i_presence (存在)
*           :  pp_name (名称)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_sse_oneline(char *p_oneline
                         , int *p_i_pmap
                         , int *p_i_operator
                         , int *p_i_data_type
                         , int *p_i_id
                         , int *p_i_presence
                         , char **pp_name)
{
    int i_id = 0;
    int i_pmap = 0;
    int i_presence = 0;
    int i_operator = 0;
    int i_data_type = 0;
    unsigned int ui_len = 0;
    char *p_tmp = NULL;
    char *p_name = NULL;
    char *p_space = NULL;

    i_id = atoi(p_oneline);
    /* skip第一个空格之前 */
    p_tmp = strchr(p_oneline, ' ');
    if (p_tmp == NULL)
    {
        return FR_FAIL;
    }
    p_tmp += 1;

    /* 取得域名城 */
    p_space = strchr(p_tmp, ' ');
    if (p_space == NULL)
    {
        return FR_FAIL;
    }
    ui_len = p_space - p_tmp;
    p_name = (char *)frmalloc(ui_len + 1);
    if (p_name == NULL)
    {
        return FR_FAIL;
    }
    snprintf(p_name, ui_len + 1, "%s", p_tmp);
    p_tmp = p_space + 1;

    /* 取得必须 */
    switch (*p_tmp)
    {
        case 'y':
        case 'Y':
            i_presence = FIX_FAST_MANDATORY;
            break;

        case 'n':
        case 'N':
            i_presence = FIX_FAST_OPIONAL;
            break;

         default:
            frfree(p_name);
            return FR_FAIL;
    }
    p_tmp++;
    if (*p_tmp != ' ')
    {
        frfree(p_name);
        return FR_FAIL;
    }
    p_tmp++;

    /* 取得操作符 */
    if (strncasecmp(p_tmp, "None ", 5) == 0)
    {
        i_operator = FIX_FAST_NONE_OPERATOR;
        p_tmp += 5;
    }
    else if (strncasecmp(p_tmp, "Constant ", 9) == 0)
    {
        i_operator = FIX_FAST_CONSTANT_OPERATOR;
        p_tmp += 9;
    }
    else if (strncasecmp(p_tmp, "Default ", 8) == 0)
    {
        i_operator = FIX_FAST_DEFAULT_OPERATOR;
        p_tmp += 8;
    }
    else if (strncasecmp(p_tmp, "Copy ", 5) == 0)
    {
        i_operator = FIX_FAST_COPY_OPERATOR;
        p_tmp += 5;
    }
    else if (strncasecmp(p_tmp, "Increment ", 10) == 0)
    {
        i_operator = FIX_FAST_INCREMENT_OPERATOR;
        p_tmp += 10;
    }
    else if (strncasecmp(p_tmp, "Delta ", 6) == 0)
    {
        i_operator = FIX_FAST_DELTA_OPERATOR;
        p_tmp += 6;
    }
    else if (strncasecmp(p_tmp, "Tail ", 6) == 0)
    {
        i_operator = FIX_FAST_TAIL_OPERATOR;
        p_tmp += 5;
    }
    else
    {
        frfree(p_name);
        return FR_FAIL;
    }

    /* 取得占位 */
    switch (i_operator)
    {
        case FIX_FAST_NONE_OPERATOR:
        case FIX_FAST_DELTA_OPERATOR:
            i_pmap = FR_NO;
            break;

        case FIX_FAST_COPY_OPERATOR:
        case FIX_FAST_INCREMENT_OPERATOR:
        case FIX_FAST_DEFAULT_OPERATOR:
        case FIX_FAST_TAIL_OPERATOR:
            i_pmap = FR_NO;
            break;

        default:
            if (i_presence == FIX_FAST_MANDATORY)
            {
                i_pmap = FR_NO;
            }
            else
            {
                i_pmap = FR_YES;
            }
            break;
    }

    /* 取得字段类型 */
    if (strcasecmp(p_tmp, "Int32") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_INT32;
    }
    else if (strcasecmp(p_tmp, "uInt32") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_UINT32;
    }
    else if (strcasecmp(p_tmp, "Int64") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_INT64;
    }
    else if (strcasecmp(p_tmp, "uInt64") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_UINT64;
    }
    else if (strcasecmp(p_tmp, "Decimal") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_DECIMAL;
    }
    else if (strcasecmp(p_tmp, "string") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_STRING;
    }
    else if (strcasecmp(p_tmp, "Byte") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_BYTE;
    }
    else if (strcasecmp(p_tmp, "Sequence") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_SEQUENCE;
    }
    else if (strcasecmp(p_tmp, "Group") == 0)
    {
        i_data_type = FIX_FAST_DATA_TP_GROUP;
    }
    else
    {
        frfree(p_name);
        return FR_FAIL;
    }

    *p_i_operator = i_operator;
    *p_i_data_type = i_data_type;
    *p_i_id = i_id;
    *p_i_presence = i_presence;
    *pp_name = p_name;
    *p_i_pmap = i_pmap;
    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所行情数据频道心跳模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_ua001(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua001)/128;
    uint32_t u32_template_id = 3001;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_ua001[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所申请逐笔行情数据或公告信息重传模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_ua002(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua002)/128;
    uint32_t u32_template_id = 3002;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_ua002[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所上报用户信息模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_ua003(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua003)/128;
    uint32_t u32_template_id = 3003;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_ua003[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所上报用户信息模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
//int fix_fast_init_szse_ua003(Frlist_header *p_lst_hd)
//{
//    /* 已经初始化过 */
//    if (frlist_size(p_lst_hd))
//    {
//        return FR_SUCC;
//    }
//    int i_ret = FR_SUCC;
//    int i_size = sizeof(arr_ua003)/128;
//    uint32_t u32_template_id = 3003;
//    int i_loop = 0;
//    int i_pmap = 0;                           /* 占位符 */
//    int i_operator = 0;                       /* 操作符 */
//    int i_data_type = 0;                      /* 数据类型 */
//    int i_decimal_idx = 0;                    /* 小数位数 */
//    int i_id = 0;                             /* 字段ID */
//    int i_presence = 0;                       /* 存在类型 */
//    char *p_name = NULL;                      /* 字段名 */
//    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
//    char *p_def_value = NULL;                 /* 默认值 */
//    unsigned int ui_def_size = 0;            /* 默认值size */
//    Fix_fast_mod *p_st_mod = NULL;
//    Frlist_node *p_st_node = NULL;
//
//    while (i_loop < i_size)
//    {
//        i_ret = fix_fast_szse_oneline(arr_ua101[i_loop], &i_pmap
//                                     , &i_operator, &i_data_type
//                                     , &i_id, &i_presence, &p_name);
//        if (i_ret != FR_SUCC)
//        {
//            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
//            return i_ret;
//        }
//
//        switch (i_id)
//        {
//            /* 设置默认值 */
//            case 999:
//                i_def_define = FR_YES;
//                ui_def_size = sizeof(uint32_t);
//                p_def_value = (char *)frmalloc(ui_def_size);
//                if (p_def_value == NULL)
//                {
//                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
//                    frfree(p_name);
//                    return FR_FAIL;
//                }
//                memcpy(p_def_value, &u32_template_id, ui_def_size);
//                break;
//
//            default:
//                break;
//        }
//
//        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
//        if (p_st_mod == NULL)
//        {
//            frfree(p_name);
//            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
//            return FR_FAIL;
//        }
//        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
//        p_st_mod->i_id = i_id;
//        p_st_mod->i_operator = i_operator;
//        p_st_mod->i_data_type = i_data_type;
//        p_st_mod->i_presence = i_presence;
//        p_st_mod->i_decimal_idx = i_decimal_idx;
//        i_decimal_idx = 0;
//        p_st_mod->i_pmap = i_pmap;
//        p_st_mod->p_name = p_name;
//        p_name = NULL;
//        p_st_mod->i_def_define = i_def_define;
//        i_def_define = FR_NO;
//        p_st_mod->p_def_value = p_def_value;
//        p_def_value = NULL;
//        p_st_mod->ui_def_size = ui_def_size;
//        ui_def_size = 0;
//        p_st_mod->i_pre_define = FR_NO;
//        p_st_mod->p_pre_value = NULL;
//        p_st_mod->ui_pre_size = 0;
//
//        /* 做成节点，插入list */
//        p_st_node = frlist_node_create(p_st_mod);
//        if (p_st_node == NULL)
//        {
//            fix_fast_mod_free(&p_st_mod);
//            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
//            return FR_FAIL;
//        }
//        frlist_push(p_lst_hd, p_st_node);
//        i_loop++;
//    }
//
//    return FR_SUCC;
//}

/*******************************************************************************
*  FUNC     :  初始化深交所发布快照行情频道统计模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_ua004(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua004)/128;
    uint32_t u32_template_id = 3004;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_ua004[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);

        /* 行情类别个数 */
        switch (i_id)
        {
            case 10208:
                p_st_mod->i_sub_node_flg = 1;
                p_lst_hd = &p_st_mod->st_sub_node;
                break;

            default:
                break;
        }
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所拒绝用户信息报告或者重传申请模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_j(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_j)/128;
    uint32_t u32_template_id = 3008;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_j[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所发布证券实时状态模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_f(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_f)/128;
    uint32_t u32_template_id = 4001;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_f[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);

        /* 行情类别个数 */
        switch (i_id)
        {
            case 10202:
                p_st_mod->i_sub_node_flg = 1;
                p_lst_hd = &p_st_mod->st_sub_node;
                break;

            default:
                break;
        }
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所发布证券实时状态模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_B(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_B)/128;
    uint32_t u32_template_id = 4002;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_B[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }

        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所发布行情快照模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_W(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_W)/128;
    uint32_t u32_template_id = 4101;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_W[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);

        switch (i_id)
        {
            /* 行情条目个数 */
            case 268:
                p_st_mod->i_sub_node_flg = 1;
                p_lst_hd = &p_st_mod->st_sub_node;
                break;

            /* 价位揭示委托笔数 */
            case 73:
                p_st_mod->i_sub_node_flg = 1;
                p_lst_hd = &p_st_mod->st_sub_node;
                break;

            default:
                break;
        }
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所发布逐笔委托行情模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_ua201(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua201)/128;
    uint32_t u32_template_id = 4201;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_ua201[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化深交所发布逐笔委成交行情模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_szse_ua202(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua202)/128;
    uint32_t u32_template_id = 4202;
    int i_loop = 0;
    int i_pmap = 0;                           /* 占位符 */
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_szse_oneline(arr_ua202[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化上交所3201模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_sse_3201(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua3201)/128;
    uint32_t u32_template_id = 3201;
    int i_loop = 0;
    int i_pmap = 0;
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_sse_oneline(arr_ua3201[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            /* 设置默认值 */
            case 35:
                i_def_define = FR_YES;
                ui_def_size = 6;
                p_def_value = (char *)frmalloc(ui_def_size + 1);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                snprintf(p_def_value, ui_def_size + 1, "UA3201");
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化上交所3202模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_sse_3202(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua3202)/128;
    uint32_t u32_template_id = 3202;
    int i_loop = 0;
    int i_pmap = 0;
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_sse_oneline(arr_ua3202[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            /* 设置默认值 */
            case 35:
                i_def_define = FR_YES;
                ui_def_size = 6;
                p_def_value = (char *)frmalloc(ui_def_size + 1);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                snprintf(p_def_value, ui_def_size + 1, "UA3202");
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化上交所3107模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_sse_3107(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua3107)/128;
    uint32_t u32_template_id = 3107;
    int i_loop = 0;
    int i_pmap = 0;
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_sse_oneline(arr_ua3107[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            /* 设置默认值 */
            case 35:
                i_def_define = FR_YES;
                ui_def_size = 6;
                p_def_value = (char *)frmalloc(ui_def_size + 1);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                snprintf(p_def_value, ui_def_size + 1, "UA3107");
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化上交所3113模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_sse_3113(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua3113)/128;
    uint32_t u32_template_id = 3113;
    int i_loop = 0;
    int i_pmap = 0;
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_sse_oneline(arr_ua3113[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            /* 设置默认值 */
            case 35:
                i_def_define = FR_YES;
                ui_def_size = 6;
                p_def_value = (char *)frmalloc(ui_def_size + 1);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                snprintf(p_def_value, ui_def_size + 1, "UA3113");
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  初始化上交所3115模板
*  ARGS     :  p_oneline (一行数据)
*           :  p_lst_hd (做成list)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  ID 域名称 必须 操作符 类型 默认值
*******************************************************************************/
int fix_fast_init_sse_3115(Frlist_header *p_lst_hd)
{
    /* 已经初始化过 */
    if (frlist_size(p_lst_hd))
    {
        return FR_SUCC;
    }
    int i_ret = FR_SUCC;
    int i_size = sizeof(arr_ua3115)/128;
    uint32_t u32_template_id = 3115;
    int i_loop = 0;
    int i_pmap = 0;
    int i_operator = 0;                       /* 操作符 */
    int i_data_type = 0;                      /* 数据类型 */
    int i_decimal_idx = 0;                    /* 小数位数 */
    int i_id = 0;                             /* 字段ID */
    int i_presence = 0;                       /* 存在类型 */
    char *p_name = NULL;                      /* 字段名 */
    int i_def_define = FR_NO;                 /* 默认值是否定义过 */
    char *p_def_value = NULL;                 /* 默认值 */
    unsigned int ui_def_size = 0;            /* 默认值size */
    Fix_fast_mod *p_st_mod = NULL;
    Frlist_node *p_st_node = NULL;

    while (i_loop < i_size)
    {
        i_ret = fix_fast_sse_oneline(arr_ua3115[i_loop], &i_pmap
                                     , &i_operator, &i_data_type
                                     , &i_id, &i_presence, &p_name);
        if (i_ret != FR_SUCC)
        {
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return i_ret;
        }

        switch (i_id)
        {
            /* 设置默认值 */
            case 999:
                i_def_define = FR_YES;
                ui_def_size = sizeof(uint32_t);
                p_def_value = (char *)frmalloc(ui_def_size);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                memcpy(p_def_value, &u32_template_id, ui_def_size);
                break;

            /* 设置默认值 */
            case 35:
                i_def_define = FR_YES;
                ui_def_size = 6;
                p_def_value = (char *)frmalloc(ui_def_size + 1);
                if (p_def_value == NULL)
                {
                    frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
                    frfree(p_name);
                    return FR_FAIL;
                }
                snprintf(p_def_value, ui_def_size + 1, "UA3115");
                break;

            default:
                break;
        }

        p_st_mod = (Fix_fast_mod *)frmalloc(sizeof(Fix_fast_mod));
        if (p_st_mod == NULL)
        {
            frfree(p_name);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        memset(p_st_mod, 0x0, sizeof(Fix_fast_mod));
        p_st_mod->i_id = i_id;
        p_st_mod->i_operator = i_operator;
        p_st_mod->i_data_type = i_data_type;
        p_st_mod->i_presence = i_presence;
        p_st_mod->i_decimal_idx = i_decimal_idx;
        i_decimal_idx = 0;
        p_st_mod->i_pmap = i_pmap;
        p_st_mod->p_name = p_name;
        p_name = NULL;
        p_st_mod->i_def_define = i_def_define;
        i_def_define = FR_NO;
        p_st_mod->p_def_value = p_def_value;
        p_def_value = NULL;
        p_st_mod->ui_def_size = ui_def_size;
        ui_def_size = 0;
        p_st_mod->i_pre_define = FR_NO;
        p_st_mod->p_pre_value = NULL;
        p_st_mod->ui_pre_size = 0;

        /* 做成节点，插入list */
        p_st_node = frlist_node_create(p_st_mod);
        if (p_st_node == NULL)
        {
            fix_fast_mod_free(&p_st_mod);
            frlist_remove_all(p_lst_hd, fix_fast_mod_node_free);
            return FR_FAIL;
        }
        frlist_push(p_lst_hd, p_st_node);
        i_loop++;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  解析int32
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer的size)
*           :  i_presence (可选flag)
*           :  pp_value (取得的值)
*           :  p_ui_out (取得的值size)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :
*******************************************************************************/
int fix_fast_decode_int32(char **pp_inbuff
                          , unsigned int *p_ui_size
                          , int i_presence
                          , void **pp_value
                          , unsigned int *p_ui_out)
{
    unsigned int i_loop = 0;
    int32_t i_value = 0;
    int32_t i_value_tmp = 0;
    int i_signed_flg = FR_NO;
    unsigned int ui_size = *p_ui_size;
    unsigned int ui_out = sizeof(int32_t);
    char *p_value = NULL;
    char *p_inbuff = *pp_inbuff;

    /* 未编码过的int值占4位，经过编码后的int值最大5位 */
    while (i_loop++ < (5 < *p_ui_size ? 5 : *p_ui_size))
    {
        /* 取得符号位 */
        if (i_loop == 1 && *p_inbuff & 0x40)
        {
            i_value = -1;
            i_signed_flg = FR_YES;
            i_value_tmp = *p_inbuff & 0x3F;
        }
        else
        {
            i_value_tmp = *p_inbuff & 0x7F;
        }

        i_value = (i_value << 7) | i_value_tmp;

        if (*p_inbuff & FIX_FAST_STOP_BIT)
        {
            if (i_presence == FIX_FAST_OPIONAL)
            {
                if (i_signed_flg == FR_NO)
                {
                    i_value -= 1;
                }
                if (i_value)
                {
                    p_value = (char *)frmalloc(ui_out);
                    if (p_value == NULL)
                    {
                        return FR_FAIL;
                    }
                    memcpy(p_value, &i_value, ui_out);
                }
            }
            else
            {
                p_value = (char *)frmalloc(ui_out);
                if (p_value == NULL)
                {
                    return FR_FAIL;
                }
                memcpy(p_value, &i_value, ui_out);
            }

            ui_size--;
            p_inbuff++;
            *pp_value = p_value;
            *p_ui_size = ui_size;
            *pp_inbuff = p_inbuff;
            *p_ui_out = ui_out;
            return FR_SUCC;
        }
        ui_size--;
        p_inbuff++;
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  解析uint32
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer的size)
*           :  i_presence (可选flag)
*           :  pp_value (取得的值)
*           :  p_ui_out (取得的值size)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  todo OPIONAL null
*******************************************************************************/
int fix_fast_decode_uint32(char **pp_inbuff
                          , unsigned int *p_ui_size
                          , int i_presence
                          , void **pp_value
                          , unsigned int *p_ui_out)
{
    unsigned int i_loop = 0;
    uint32_t ui_value = 0;
    uint32_t ui_value_tmp = 0;
    unsigned int ui_size = *p_ui_size;
    unsigned int ui_out = sizeof(uint32_t);
    char *p_inbuff = *pp_inbuff;
    char *p_value = NULL;

    /* 未编码过的int值占4位，经过编码后的int值最大5位 */
    while (i_loop++ < (5 < *p_ui_size ? 5 : *p_ui_size))
    {
        ui_value_tmp = *p_inbuff & 0x7F;
        ui_value = (ui_value << 7) | ui_value_tmp;

        if (*p_inbuff & FIX_FAST_STOP_BIT)
        {
            if (i_presence == FIX_FAST_OPIONAL)
            {
                if (ui_value)
                {
                    ui_value -= 1;
                    p_value = (char *)frmalloc(ui_out);
                    if (p_value == NULL)
                    {
                        return FR_FAIL;
                    }
                    memcpy(p_value, &ui_value, ui_out);
                }
                else
                {
                    ui_out = 0;
                }
            }
            else
            {
                p_value = (char *)frmalloc(ui_out);
                if (p_value == NULL)
                {
                    return FR_FAIL;
                }
                memcpy(p_value, &ui_value, ui_out);
            }

            ui_size--;
            p_inbuff++;
            *pp_value = p_value;
            *p_ui_size = ui_size;
            *pp_inbuff = p_inbuff;
            *p_ui_out = ui_out;
            return FR_SUCC;
        }
        ui_size--;
        p_inbuff++;
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  解析int64
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer的size)
*           :  i_presence (可选flag)
*           :  pp_value (取得的值)
*           :  p_ui_out (取得的值size)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  todo OPIONAL null
*******************************************************************************/
int fix_fast_decode_int64(char **pp_inbuff
                          , unsigned int *p_ui_size
                          , int i_presence
                          , void **pp_value
                          , unsigned int *p_ui_out)
{
    unsigned int i_loop = 0;
    int64_t i_value = 0;
    int64_t i_value_tmp = 0;
    int i_signed_flg = FR_NO;
    unsigned int ui_size = *p_ui_size;
    unsigned int ui_out = sizeof(int64_t);
    char *p_inbuff = *pp_inbuff;
    char *p_value = NULL;

    while (i_loop++ < (10 < *p_ui_size ? 10 : *p_ui_size))
    {
        /* 取得符号位 */
        if (i_loop == 1 && *p_inbuff & 0x40)
        {
            i_value = -1;
            i_signed_flg = FR_YES;
            i_value_tmp = *p_inbuff & 0x3F;
        }
        else
        {
            i_value_tmp = *p_inbuff & 0x7F;
        }

        i_value = (i_value << 7) | i_value_tmp;

        if (*p_inbuff & FIX_FAST_STOP_BIT)
        {
            if (i_presence == FIX_FAST_OPIONAL)
            {
                if (i_signed_flg == FR_NO)
                {
                    i_value -= 1;
                }
                if (i_value)
                {
                    p_value = (char *)frmalloc(ui_out);
                    if (p_value == NULL)
                    {
                        return FR_FAIL;
                    }
                    memcpy(p_value, &i_value, ui_out);
                }
            }
            else
            {
                p_value = (char *)frmalloc(ui_out);
                if (p_value == NULL)
                {
                    return FR_FAIL;
                }
                memcpy(p_value, &i_value, ui_out);
            }

            ui_size--;
            p_inbuff++;
            *pp_value = p_value;
            *p_ui_size = ui_size;
            *pp_inbuff = p_inbuff;
            *p_ui_out = ui_out;
            return FR_SUCC;
        }
        ui_size--;
        p_inbuff++;
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  解析uint64
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer的size)
*           :  i_presence (可选flag)
*           :  pp_value (取得的值)
*           :  p_ui_out (取得的值size)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  todo OPIONAL null
*******************************************************************************/
int fix_fast_decode_uint64(char **pp_inbuff
                          , unsigned int *p_ui_size
                          , int i_presence
                          , void **pp_value
                          , unsigned int *p_ui_out)
{
    unsigned int i_loop = 0;
    uint64_t ui_value = 0;
    uint64_t ui_value_tmp = 0;
    unsigned int ui_size = *p_ui_size;
    unsigned int ui_out = sizeof(uint64_t);
    char *p_inbuff = *pp_inbuff;
    char *p_value = NULL;

    /* 未编码过的int值占9位，经过编码后的int值最大10位 */
    while (i_loop++ < (10 < *p_ui_size ? 10 : *p_ui_size))
    {
        ui_value_tmp = *p_inbuff & 0x7F;
        ui_value = (ui_value << 7) | ui_value_tmp;

        if (*p_inbuff & FIX_FAST_STOP_BIT)
        {
            if (i_presence == FIX_FAST_OPIONAL)
            {
                if (ui_value)
                {
                    ui_value -= 1;
                    p_value = (char *)frmalloc(ui_out);
                    if (p_value == NULL)
                    {
                        return FR_FAIL;
                    }
                    memcpy(p_value, &ui_value, ui_out);
                }
                else
                {
                    ui_out = 0;
                }
            }
            else
            {
                p_value = (char *)frmalloc(ui_out);
                if (p_value == NULL)
                {
                    return FR_FAIL;
                }
                memcpy(p_value, &ui_value, ui_out);
            }

            ui_size--;
            p_inbuff++;
            *pp_value = p_value;
            *p_ui_size = ui_size;
            *pp_inbuff = p_inbuff;
            *p_ui_out = ui_out;
            return FR_SUCC;
        }
        ui_size--;
        p_inbuff++;
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  解析decimal
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer的size)
*           :  i_presence (可选flag)
*           :  pp_value (取得的值)
*           :  p_ui_out (取得的值size)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :
*******************************************************************************/
int fix_fast_decode_decimal(char **pp_inbuff
                            , unsigned int *p_ui_size
                            , int i_presence
                            , void **pp_value
                            , unsigned int *p_ui_out)
{
    int i_ret = FR_SUCC;
    void *p_exponential = NULL;
    void *p_mantissa = NULL;
    int i_exponential = 0;
    int i_mantissa = 0;
    unsigned int ui_size = 0;
    unsigned int ui_out = sizeof(Fix_fast_dec);
    Fix_fast_dec *p_st_dec = NULL;

    /* 取得指数 */
    i_ret = fix_fast_decode_int32(pp_inbuff, p_ui_size, i_presence
                                  , &p_exponential, &ui_size);
    if (i_ret != FR_SUCC)
    {
        return i_ret;
    }
    if (p_exponential == NULL)
    {
        *pp_value = NULL;
        return FR_SUCC;
    }
    /* 取得尾数 */
    i_ret = fix_fast_decode_int32(pp_inbuff, p_ui_size, FIX_FAST_MANDATORY
                                 , &p_mantissa, &ui_size);
    if (i_ret != FR_SUCC)
    {
        frfree(p_exponential);
        return i_ret;
    }
    memcpy(&i_exponential, p_exponential, sizeof(uint32_t));
    frfree(p_exponential);
    memcpy(&i_mantissa, p_mantissa, sizeof(uint32_t));
    frfree(p_mantissa);

    p_st_dec = (Fix_fast_dec *)frmalloc(sizeof(Fix_fast_dec));
    if (p_st_dec == NULL)
    {
        return FR_FAIL;
    }
    p_st_dec->i_exponential = i_exponential;
    p_st_dec->i_mantissa = i_mantissa;

    *pp_value = p_st_dec;
    *p_ui_out = ui_out;
    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  解析ascii string
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer的size)
*           :  i_presence (可选flag)
*           :  pp_value (取得的值)
*           :  p_ui_out (取得的值size)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :
*******************************************************************************/
int fix_fast_decode_ascii(char **pp_inbuff
                          , unsigned int *p_ui_size
                          , int i_presence
                          , void **pp_value
                          , unsigned int *p_ui_out)
{
    int i_end_flg = FR_NO;
    unsigned int ui_loop = 0;
    char *p_inbuff = *pp_inbuff;
    char *p_value = NULL;

    while (ui_loop < *p_ui_size)
    {
        if (p_inbuff[ui_loop++] & FIX_FAST_STOP_BIT)
        {
            i_end_flg = FR_YES;
            break;
        }
    }
    /* 没有结束符 */
    if (i_end_flg == FR_NO)
    {
        return FR_FAIL;
    }

    /* 取得value */
    p_value = (char *)frmalloc(ui_loop + 1);
    if (p_value == NULL)
    {
        return FR_FAIL;
    }
    memcpy(p_value, p_inbuff, ui_loop);
    p_value[ui_loop] = '\0';
    p_value[ui_loop - 1] &= 0x7F;

    *p_ui_size -= ui_loop;
    *pp_inbuff = p_inbuff + ui_loop;
    /* 表示NULL */
    if (i_presence == FIX_FAST_OPIONAL
        && ui_loop == 1 && *p_value == 0)
    {
        frfree(p_value);
        p_value = NULL;
        ui_loop = 0;
    }
    else if (*p_value == 0)
    {
        ui_loop = 0;
    }

    *pp_value = p_value;
    *p_ui_out = ui_loop;
    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  解析unicode string
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer的size)
*           :  i_presence (可选flag)
*           :  pp_value (取得的值)
*           :  p_ui_out (取得的值size)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :
*******************************************************************************/
int fix_fast_decode_unicode(char **pp_inbuff
                            , unsigned int *p_ui_size
                            , int i_presence
                            , void **pp_value
                            , unsigned int *p_ui_out)
{
    int i_ret = FR_SUCC;
    uint32_t ui_len = 0;
    unsigned int ui_out_size = 0;
    void *p_len = NULL;
    void *p_value = NULL;

    i_ret = fix_fast_decode_uint32(pp_inbuff, p_ui_size, i_presence
                                  , &p_len, &ui_out_size);
    if (i_ret != FR_SUCC)
    {
        return i_ret;
    }
    if (p_len == NULL)
    {
        *pp_value = NULL;
        *p_ui_out = 0;
        return FR_SUCC;
    }

    memcpy(&ui_len, p_len, sizeof(uint32_t));
    frfree(p_len);
    /* 取得value */
    if (ui_len > *p_ui_size)
    {
        return FR_FAIL;
    }
    p_value = (char *)frmalloc(ui_len + 1);
    if (p_value == NULL)
    {
        return FR_FAIL;
    }
    memcpy(p_value, *pp_inbuff, ui_len);
    ((char *)p_value)[ui_len] = '\0';

    *pp_inbuff += ui_len;
    *p_ui_size -= ui_len;
    *pp_value = p_value;
    *p_ui_out = ui_len;
    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  取得数据流中的原始数据
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer的size)
*           :  p_st_fast (fast信息)
*           :  pp_result_value (取得的值)
*           :  p_ui_out (取得的值size)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :
*******************************************************************************/
int fix_fast_get_org_data(char **pp_inbuff
                          , unsigned int *p_ui_size
                          , Fix_fast_mod *p_st_fast
                          , void **pp_result_value
                          , unsigned int *p_ui_out)
{
    int i_ret = FR_SUCC;

    switch (p_st_fast->i_data_type)
    {
        case FIX_FAST_DATA_TP_INT32:
            i_ret = fix_fast_decode_int32(pp_inbuff, p_ui_size
                                         , p_st_fast->i_presence
                                         , pp_result_value
                                         , p_ui_out);
            break;

        case FIX_FAST_DATA_TP_UINT32:
            i_ret = fix_fast_decode_uint32(pp_inbuff, p_ui_size
                                         , p_st_fast->i_presence
                                         , pp_result_value
                                         , p_ui_out);
            break;

        case FIX_FAST_DATA_TP_INT64:
            i_ret = fix_fast_decode_int64(pp_inbuff, p_ui_size
                                         , p_st_fast->i_presence
                                         , pp_result_value
                                         , p_ui_out);
            break;

        case FIX_FAST_DATA_TP_UINT64:
            i_ret = fix_fast_decode_uint64(pp_inbuff, p_ui_size
                                         , p_st_fast->i_presence
                                         , pp_result_value
                                         , p_ui_out);
            break;

        case FIX_FAST_DATA_TP_DECIMAL:
            i_ret = fix_fast_decode_decimal(pp_inbuff, p_ui_size
                                           , p_st_fast->i_presence
                                           , pp_result_value
                                           , p_ui_out);
            break;

        case FIX_FAST_DATA_TP_STRING:
            i_ret = fix_fast_decode_ascii(pp_inbuff, p_ui_size
                                         , p_st_fast->i_presence
                                         , pp_result_value
                                         , p_ui_out);
            break;

        case FIX_FAST_DATA_TP_BYTE:
            i_ret = fix_fast_decode_unicode(pp_inbuff, p_ui_size
                                           , p_st_fast->i_presence
                                           , pp_result_value
                                           , p_ui_out);
            break;

        default:
            frdbg("unsupport!n");
            i_ret = FR_FAIL;
            break;
    }

    return i_ret;
}

/*******************************************************************************
*  FUNC     :  取得不通过PAMP设定数据
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer的size)
*           :  p_st_fast (fast信息)
*           :  pp_result_value (取得的值)
*           :  p_ui_out (取得的值size)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :
*******************************************************************************/
int fix_fast_get_data(char **pp_inbuff
                     , unsigned int *p_ui_size
                     , Fix_fast_mod *p_st_fast
                     , void **pp_result_value
                     , unsigned int *p_ui_out)
{
    int i_ret = FR_SUCC;
    int32_t i32_value = 0;
    int32_t i32_pre_value = 0;
    uint32_t ui32_value = 0;
    uint32_t ui32_pre_value = 0;
    int64_t i64_value = 0;
    int64_t i64_pre_value = 0;
    uint64_t ui64_value = 0;
    uint64_t ui64_pre_value = 0;
    int32_t i32_diff_len = 0;
    int i_diff_len = 0;
    unsigned int ui_out_size = 0;
    unsigned int ui_len = 0;
    unsigned int ui_curr_len = 0;
    void *p_org_value = NULL;
    char c_first_byte = **pp_inbuff;
    char *p_curr_value = NULL;

    /* 不通过PAMP设定的操作符只有三种NONE/CONSTANT/DELTA */
    switch (p_st_fast->i_operator)
    {
        /* 直接是源值 */
        case FIX_FAST_NONE_OPERATOR:
            i_ret = fix_fast_get_org_data(pp_inbuff, p_ui_size, p_st_fast
                                         , pp_result_value, p_ui_out);
            if (i_ret != FR_SUCC)
            {
                return i_ret;
            }
            break;

        case FIX_FAST_CONSTANT_OPERATOR: /* 不需要进行传输 */
            if (p_st_fast->p_def_value)
            {
                *pp_result_value = frmemdup(p_st_fast->p_def_value
                                           , p_st_fast->ui_def_size);
                *p_ui_size = p_st_fast->ui_pre_size;
            }
            break;

        case FIX_FAST_DELTA_OPERATOR:
            /* 根据数据类型和前后关联值取得现有数据 */
            switch (p_st_fast->i_data_type)
            {
                case FIX_FAST_DATA_TP_INT32:
                    i_ret = fix_fast_decode_int32(pp_inbuff, p_ui_size
                                                 , p_st_fast->i_presence
                                                 , &p_org_value, &ui_out_size);
                    if (i_ret != FR_SUCC)
                    {
                        return i_ret;
                    }
                	if (p_org_value)
                    {
                        /* 前值存在，与前值比较 */
                        if (p_st_fast->i_pre_define == FR_YES)
                        {
                            if (p_st_fast->p_pre_value)
                            {
                                memcpy(&i32_pre_value, p_st_fast->p_pre_value
                                       , p_st_fast->ui_pre_size);
                                memcpy(&i32_value, p_org_value, ui_out_size);
                                i32_value += i32_pre_value;
                                memcpy(p_org_value, &i32_value, ui_out_size);
                            }
                        }
                        /* 默认值存在，与默认值比较 */
                        else if (p_st_fast->p_def_value)
                        {
                            memcpy(&i32_pre_value, p_st_fast->p_def_value
                                   , p_st_fast->ui_def_size);
                            memcpy(&i32_value, p_org_value, ui_out_size);
                            i32_value += i32_pre_value;
                            memcpy(p_org_value, &i32_value, ui_out_size);
                        }
                    }
                	break;

                 case FIX_FAST_DATA_TP_UINT32:
                    i_ret = fix_fast_decode_uint32(pp_inbuff, p_ui_size
                                                  , p_st_fast->i_presence
                                                  , &p_org_value, &ui_out_size);
                    if (i_ret != FR_SUCC)
                    {
                        return i_ret;
                    }
                	if (p_org_value)
                    {
                        /* 前值存在，与前值比较 */
                        if (p_st_fast->i_pre_define == FR_YES)
                        {
                            if (p_st_fast->p_pre_value)
                            {
                                memcpy(&ui32_pre_value, p_st_fast->p_pre_value
                                       , p_st_fast->ui_pre_size);
                                memcpy(&ui32_value, p_org_value, ui_out_size);
                                ui32_value += ui32_pre_value;
                                memcpy(p_org_value, &ui32_value, ui_out_size);
                            }
                        }
                        /* 默认值存在，与默认值比较 */
                        else if (p_st_fast->p_def_value)
                        {
                            memcpy(&ui32_pre_value, p_st_fast->p_def_value
                                   , p_st_fast->ui_def_size);
                            memcpy(&ui32_value, p_org_value, ui_out_size);
                            ui32_value += ui32_pre_value;
                            memcpy(p_org_value, &ui32_value, ui_out_size);
                        }
                    }
                	break;

                case FIX_FAST_DATA_TP_INT64:
                    i_ret = fix_fast_decode_int64(pp_inbuff, p_ui_size
                                                  , p_st_fast->i_presence
                                                  , &p_org_value, &ui_out_size);
                    if (i_ret != FR_SUCC)
                    {
                        return i_ret;
                    }
                	if (p_org_value)
                    {
                        /* 前值存在，与前值比较 */
                        if (p_st_fast->i_pre_define == FR_YES)
                        {
                            if (p_st_fast->p_pre_value)
                            {
                                memcpy(&i64_pre_value, p_st_fast->p_pre_value
                                       , p_st_fast->ui_pre_size);
                                memcpy(&i64_value, p_org_value, ui_out_size);
                                i64_value += i64_pre_value;
                                memcpy(p_org_value, &i64_value, ui_out_size);
                            }
                        }
                        /* 默认值存在，与默认值比较 */
                        else if (p_st_fast->p_def_value)
                        {
                            memcpy(&i64_pre_value, p_st_fast->p_def_value
                                   , p_st_fast->ui_def_size);
                            memcpy(&i64_value, p_org_value, ui_out_size);
                            i64_value += i64_pre_value;
                            memcpy(p_org_value, &i64_value, ui_out_size);
                        }
                    }
                	break;

                 case FIX_FAST_DATA_TP_UINT64:
                    i_ret = fix_fast_decode_uint64(pp_inbuff, p_ui_size
                                                  , p_st_fast->i_presence
                                                  , &p_org_value, &ui_out_size);
                    if (i_ret != FR_SUCC)
                    {
                        return i_ret;
                    }
                	if (p_org_value)
                    {
                        /* 前值存在，与前值比较 */
                        if (p_st_fast->i_pre_define == FR_YES)
                        {
                            if (p_st_fast->p_pre_value)
                            {
                                memcpy(&ui64_pre_value, p_st_fast->p_pre_value
                                       , p_st_fast->ui_pre_size);
                                memcpy(&ui64_value, p_org_value, ui_out_size);
                                ui64_value += ui64_pre_value;
                                memcpy(p_org_value, &ui64_value, ui_out_size);
                            }
                        }
                        /* 默认值存在，与默认值比较 */
                        else if (p_st_fast->p_def_value)
                        {
                            memcpy(&ui64_pre_value, p_st_fast->p_def_value
                                   , p_st_fast->ui_def_size);
                            memcpy(&ui64_value, p_org_value, ui_out_size);
                            ui64_value += ui64_pre_value;
                            memcpy(p_org_value, &ui64_value, ui_out_size);
                        }
                    }
                	break;

                case FIX_FAST_DATA_TP_DECIMAL:
                    i_ret = fix_fast_decode_decimal(pp_inbuff, p_ui_size
                                                   , p_st_fast->i_presence
                                                   , &p_org_value, &ui_out_size);
                    if (i_ret != FR_SUCC)
                    {
                        return i_ret;
                    }

                    if (p_org_value)
                    {
                        /* 前值存在，与前值比较 */
                        if (p_st_fast->i_pre_define == FR_YES)
                        {
                            if (p_st_fast->p_pre_value)
                            {
                                ((Fix_fast_dec *)p_org_value)->i_exponential +=
                                    ((Fix_fast_dec *)p_st_fast->p_pre_value)->i_exponential;
                                ((Fix_fast_dec *)p_org_value)->i_mantissa +=
                                    ((Fix_fast_dec *)p_st_fast->p_pre_value)->i_mantissa;
                            }
                        }
                        /* 默认值存在，与默认值比较 */
                        else if (p_st_fast->p_def_value)
                        {
                            ((Fix_fast_dec *)p_org_value)->i_exponential +=
                                ((Fix_fast_dec *)p_st_fast->p_def_value)->i_exponential;
                            ((Fix_fast_dec *)p_org_value)->i_mantissa +=
                                ((Fix_fast_dec *)p_st_fast->p_def_value)->i_mantissa;
                        }
                    }
                    break;

                case FIX_FAST_DATA_TP_STRING:
                    /* 取得差异位 */
                    i_ret = fix_fast_decode_int32(pp_inbuff, p_ui_size
                                                 , FIX_FAST_MANDATORY
                                                 , &p_org_value, &ui_out_size);
                    if (i_ret != FR_SUCC)
                    {
                        return i_ret;
                    }
                    memcpy(&i32_diff_len, p_org_value, ui_out_size);
                    frfree(p_org_value);
                    /* 取得字符串 */
                    i_ret = fix_fast_decode_ascii(pp_inbuff, p_ui_size
                                                 , p_st_fast->i_presence
                                                 , &p_org_value, &ui_out_size);
                    if (i_ret != FR_SUCC)
                    {
                        return i_ret;
                    }

                    if (p_org_value)
                    {
                        ui_len = strlen((char *)p_org_value);
                        /* 差异位大于0，从后开始截断 */
                        if (i_diff_len > 0)
                        {
                            /* 前值存在，与前值比较 */
                            if (p_st_fast->i_pre_define == FR_YES)
                            {
                                if (p_st_fast->p_pre_value == NULL)
                                {
                                    frfree(p_org_value);
                                    return FR_FAIL;
                                }

                                ui_curr_len = strlen((char *)p_st_fast->p_pre_value);
                                if (ui_curr_len < (unsigned int)i_diff_len)
                                {
                                    return FR_FAIL;
                                }
                                p_curr_value = (char *)frmalloc(ui_curr_len + ui_len);
                                if (p_curr_value == NULL)
                                {
                                    frfree(p_org_value);
                                    return FR_FAIL;
                                }
                                memcpy(p_curr_value, p_st_fast->p_pre_value
                                      , ui_curr_len - i_diff_len);
                                snprintf(p_curr_value + ui_curr_len - i_diff_len
                                        , ui_len + ui_curr_len - i_diff_len
                                        , "%s", (char *)p_org_value);
                                frfree(p_org_value);
                                p_org_value = p_curr_value;
                                ui_out_size = ui_len + ui_curr_len - i_diff_len;
                                p_curr_value = NULL;
                            }
                            /* 默认值存在，与默认值比较 */
                            else if (p_st_fast->p_def_value)
                            {
                                ui_curr_len = strlen((char *)p_st_fast->p_def_value);
                                if (ui_curr_len < (unsigned int)i_diff_len)
                                {
                                    return FR_FAIL;
                                }
                                p_curr_value = (char *)frmalloc(ui_curr_len + ui_len);
                                if (p_curr_value == NULL)
                                {
                                    frfree(p_org_value);
                                    return FR_FAIL;
                                }
                                memcpy(p_curr_value, p_st_fast->p_def_value
                                      , ui_curr_len - i_diff_len);
                                snprintf(p_curr_value + ui_curr_len - i_diff_len
                                        , ui_len + ui_curr_len - i_diff_len
                                        , "%s", (char *)p_org_value);
                                frfree(p_org_value);
                                p_org_value = p_curr_value;
                                ui_out_size = ui_len + ui_curr_len - i_diff_len;
                                p_curr_value = NULL;
                            }
                        }
                        /* 差异位小于0，从前开始截断 */
                        else if (i_diff_len < 0)
                        {
                            i_diff_len = abs(i_diff_len);
                            if (p_st_fast->i_pre_define == FR_YES)
                            {
                                if (p_st_fast->p_pre_value == NULL)
                                {
                                    frfree(p_org_value);
                                    return FR_FAIL;
                                }

                                ui_curr_len = strlen((char *)p_st_fast->p_pre_value);
                                if (ui_curr_len < (unsigned int)i_diff_len)
                                {
                                    return FR_FAIL;
                                }
                                p_curr_value = (char *)frmalloc(ui_curr_len + ui_len);
                                if (p_curr_value == NULL)
                                {
                                    frfree(p_org_value);
                                    return FR_FAIL;
                                }
                                snprintf(p_curr_value, ui_curr_len + ui_len
                                        , "%s%s", (char *)p_org_value
                                        , ((char *)p_st_fast->p_pre_value + i_diff_len));
                                frfree(p_org_value);
                                p_org_value = p_curr_value;
                                ui_out_size = ui_len + ui_curr_len - i_diff_len;
                                p_curr_value = NULL;
                            }
                            else if (p_st_fast->p_def_value)
                            {
                                ui_curr_len = strlen((char *)p_st_fast->p_def_value);
                                if (ui_curr_len < (unsigned int)i_diff_len)
                                {
                                    return FR_FAIL;
                                }
                                p_curr_value = (char *)frmalloc(ui_curr_len + ui_len);
                                if (p_curr_value == NULL)
                                {
                                    frfree(p_org_value);
                                    return FR_FAIL;
                                }
                                snprintf(p_curr_value, ui_curr_len + ui_len
                                        , "%s%s", (char *)p_org_value
                                        , (char *)p_st_fast->p_def_value + i_diff_len);
                                frfree(p_org_value);
                                p_org_value = p_curr_value;
                                ui_out_size = ui_len + ui_curr_len - i_diff_len;
                                p_curr_value = NULL;
                            }
                        }
                        /* 差异位等于-0，从前开始追加 */
                        else if (c_first_byte & 0x40) //-0
                        {
                            if (p_st_fast->i_pre_define == FR_YES)
                            {
                                if (p_st_fast->p_pre_value)
                                {
                                    ui_curr_len = strlen((char *)p_st_fast->p_pre_value);
                                    p_curr_value = (char *)frmalloc(ui_curr_len + ui_len + 1);
                                    if (p_curr_value == NULL)
                                    {
                                        frfree(p_org_value);
                                        return FR_FAIL;
                                    }
                                    snprintf(p_curr_value, ui_curr_len + ui_len
                                            , "%s%s", (char *)p_org_value
                                            , (char *)p_st_fast->p_pre_value);
                                    frfree(p_org_value);
                                    p_org_value = p_curr_value;
                                    ui_out_size = ui_len + ui_curr_len;
                                    p_curr_value = NULL;
                                }
                            }
                            else if (p_st_fast->p_def_value)
                            {
                                ui_curr_len = strlen((char *)p_st_fast->p_def_value);
                                p_curr_value = (char *)frmalloc(ui_curr_len + ui_len + 1);
                                if (p_curr_value == NULL)
                                {
                                    frfree(p_org_value);
                                    return FR_FAIL;
                                }
                                snprintf(p_curr_value, ui_curr_len + ui_len
                                        , "%s%s", (char *)p_org_value
                                        , (char *)p_st_fast->p_def_value);
                                frfree(p_org_value);
                                p_org_value = p_curr_value;
                                ui_out_size = ui_len + ui_curr_len;
                                p_curr_value = NULL;
                            }
                        }
                        /* 差异位等于+0，从后开始追加 */
                        else
                        {
                            if (p_st_fast->i_pre_define == FR_YES)
                            {
                                if (p_st_fast->p_pre_value)
                                {
                                    ui_curr_len = strlen((char *)p_st_fast->p_pre_value);
                                    p_curr_value = (char *)frmalloc(ui_curr_len + ui_len + 1);
                                    if (p_curr_value == NULL)
                                    {
                                        frfree(p_org_value);
                                        return FR_FAIL;
                                    }
                                    snprintf(p_curr_value, ui_curr_len + ui_len
                                            , "%s%s", (char *)p_st_fast->p_pre_value
                                            , (char *)p_org_value);
                                    frfree(p_org_value);
                                    p_org_value = p_curr_value;
                                    ui_out_size = ui_len + ui_curr_len;
                                    p_curr_value = NULL;
                                }
                            }
                            else if (p_st_fast->p_def_value)
                            {
                                ui_curr_len = strlen((char *)p_st_fast->p_def_value);
                                p_curr_value = (char *)frmalloc(ui_curr_len + ui_len + 1);
                                if (p_curr_value == NULL)
                                {
                                    frfree(p_org_value);
                                    return FR_FAIL;
                                }
                                snprintf(p_curr_value, ui_curr_len + ui_len
                                        , "%s%s", (char *)p_st_fast->p_def_value
                                        , (char *)p_org_value);
                                frfree(p_org_value);
                                p_org_value = p_curr_value;
                                ui_out_size = ui_len + ui_curr_len;
                                p_curr_value = NULL;
                            }
                        }
                    }
                    break;

                default:
                    frdbg("unsupport type\n");
                    return FR_FAIL;
            }

            *pp_result_value = p_org_value;
            *p_ui_out = ui_out_size;
            break;

        default:
            return FR_FAIL;
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  解析raw data
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer size)
*           :  p_lst_mod (fast模板)
*           :  p_lst_hd (取得的值)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  todo OPIONAL null
*******************************************************************************/
int fix_fast_parse_raw(char **pp_inbuff
                       , unsigned int *p_ui_size
                       , Frlist_header *p_lst_mod
                       , Frlist_header *p_lst_hd
                       , unsigned int *p_ui_deeps
                       , unsigned int ui_deep
                       , char *p_pamp
                       , unsigned int ui_pmap_size
                       , unsigned int *p_ui_loop
                       , unsigned int *p_ui_loop_loop)
{
    int i_ret = FR_SUCC;
    char c_pmap_bit = 0;
    int32_t i32_value = 0;
    uint32_t ui32_value = 0;
    int64_t i64_value = 0;
    uint64_t ui64_value = 0;
    uint64_t ui64_count = 0;
    unsigned int ui_index = 0;
    unsigned int ui_result_size = 0;
    unsigned int ui_tag_name_len = 0;
    unsigned int ui_tmp_len = 0;
    unsigned int ui_first_count = 0;
    void *p_result_value = NULL;
    Fix_fast_mod *p_st_fast = NULL;
    Frlist_node *p_st_node = NULL;
    char *p_value = NULL;
    Fix_param *p_st_data = NULL;
    Frlist_node *p_st_node_new = NULL;
    Frbindata *p_st_value = NULL;

    /* 解析rawdata */
    p_st_node = FRLIST_FIRST_NODE(p_lst_mod);
    while (p_st_node)
    {
        p_st_fast = (Fix_fast_mod *)FRLIST_GET_NODE_DATA(p_st_node);
        /* 不占用PMAP位,但是数据再数据流中 */
        if (p_st_fast->i_pmap == FR_NO)
        {
            i_ret = fix_fast_get_data(pp_inbuff, p_ui_size, p_st_fast
                                     , &p_result_value, &ui_result_size);
            if (i_ret != FR_SUCC)
            {
                frdbg("fix_fast_get_data failed\n");
                return i_ret;
            }
        }
        /* 存在PMAP位，根据PMAP值取得数据 */
        else if (p_st_fast->i_pmap == FR_YES)
        {
            if (*p_ui_loop < ui_pmap_size)
            {
                c_pmap_bit = p_pamp[*p_ui_loop];
                /* PMAP位为1 */
                if ((c_pmap_bit << *p_ui_loop_loop) & 0x80)
                {
                    //parse data
                    i_ret = fix_fast_get_org_data(pp_inbuff, p_ui_size
                                                 , p_st_fast
                                                 , &p_result_value
                                                 , &ui_result_size);
                    if (i_ret != FR_SUCC)
                    {
                        frdbg("fix_fast_get_org_data failed\n");
                        return i_ret;
                    }
                }
                /* PMAP位为0 */
                else
                {
                    /* 根据操作符取值 */
                    switch (p_st_fast->i_operator)
                    {
                        case FIX_FAST_CONSTANT_OPERATOR: /* null */
                            break;

                        case FIX_FAST_DEFAULT_OPERATOR:  /* 值为默认值 */
                            p_result_value = frmemdup(p_st_fast->p_def_value
                                                     , p_st_fast->ui_def_size);
                            break;

                        case FIX_FAST_COPY_OPERATOR:     /* 首选前值，次选默认值 */
                            if (p_st_fast->i_pre_define == FR_YES)
                            {
                                if (p_st_fast->p_pre_value)
                                {
                                    p_result_value = frmemdup(p_st_fast->p_pre_value
                                                              , p_st_fast->ui_def_size);
                                    ui_result_size = p_st_fast->ui_def_size;
                                }
                            }
                            else if (p_st_fast->p_def_value)
                            {
                                p_result_value = frmemdup(p_st_fast->p_def_value
                                                          , p_st_fast->ui_def_size);
                                ui_result_size = p_st_fast->ui_def_size;
                            }
                            /* 设置前值 */
                            //__fix_fast_reset_pre(p_st_fast, p_result_value, ui_result_size);
                            break;

                        case FIX_FAST_INCREMENT_OPERATOR:
                            /* 有前值为前值+1 */
                            if (p_st_fast->i_pre_define == FR_YES)
                            {
                                if (p_st_fast->p_pre_value)
                                {
                                    /* INCREMENT操作符只适用于整数 */
                                    switch (p_st_fast->i_data_type)
                                    {
                                        case FIX_FAST_DATA_TP_INT32:
                                            ui_result_size = sizeof(int32_t);
                                            memcpy(&i32_value
                                                   , p_st_fast->p_pre_value
                                                   , ui_result_size);
                                            i32_value += 1;
                                            p_result_value = frmemdup((void *)&i32_value
                                                                      , ui_result_size);
                                            break;

                                        case FIX_FAST_DATA_TP_UINT32:
                                            ui_result_size = sizeof(uint32_t);
                                            memcpy(&ui32_value
                                                   , p_st_fast->p_pre_value
                                                   , ui_result_size);
                                            ui32_value += 1;
                                            p_result_value = frmemdup((void *)&ui32_value
                                                                     , ui_result_size);
                                            break;

                                        case FIX_FAST_DATA_TP_INT64:
                                            ui_result_size = sizeof(int64_t);
                                            memcpy(&i64_value
                                                   , p_st_fast->p_pre_value
                                                   , ui_result_size);
                                            i64_value += 1;
                                            p_result_value = frmemdup((void *)&i64_value
                                                                     , ui_result_size);
                                            break;

                                        case FIX_FAST_DATA_TP_UINT64:
                                            ui_result_size = sizeof(uint64_t);
                                            memcpy(&ui64_value
                                                   , p_st_fast->p_pre_value
                                                   , ui_result_size);
                                            ui64_value += 1;
                                            p_result_value = frmemdup((void *)&ui64_value
                                                                     , ui_result_size);
                                            break;

                                        default:
                                            frdbg("format incorrect\n");
                                            return FR_FAIL;
                                    }
                                }
                                else
                                {
                                    /* INCREMENT操作符只适用于整数 */
                                    switch (p_st_fast->i_data_type)
                                    {
                                        case FIX_FAST_DATA_TP_INT32:
                                            ui_result_size = sizeof(int32_t);
                                            i32_value = 1;
                                            p_result_value = frmemdup((void *)&i32_value
                                                                     , ui_result_size);
                                            break;

                                        case FIX_FAST_DATA_TP_UINT32:
                                            ui_result_size = sizeof(uint32_t);
                                            ui32_value = 1;
                                            p_result_value = frmemdup((void *)&ui32_value
                                                                     , ui_result_size);
                                            break;

                                        case FIX_FAST_DATA_TP_INT64:
                                            ui_result_size = sizeof(int64_t);
                                            i64_value = 1;
                                            p_result_value = frmemdup((void *)&i64_value
                                                                     , ui_result_size);
                                            break;

                                        case FIX_FAST_DATA_TP_UINT64:
                                            ui_result_size = sizeof(uint64_t);
                                            ui64_value = 1;
                                            p_result_value = frmemdup((void *)&ui64_value
                                                                     , ui_result_size);
                                            break;

                                        default:
                                            frdbg("format incorrect\n");
                                            return FR_FAIL;
                                    }
                                }
                            }
                            /* 有初始值为初始值 */
                            else if (p_st_fast->p_def_value)
                            {
                                p_result_value = frmemdup(p_st_fast->p_def_value
                                                          , p_st_fast->ui_def_size);
                                ui_result_size = p_st_fast->ui_def_size;
                            }
                            /* 设置前值 */
                            //__fix_fast_reset_pre(p_st_fast, p_result_value, ui_result_size);
                            break;

                        case FIX_FAST_TAIL_OPERATOR:
                            printf("tail operator, please attention\n");
                            break;

                        default:
                            frdbg("PMAP format incorrect\n");
                            return FR_FAIL;
                    }
                }

                *p_ui_loop_loop += 1;
                /* 重置 */
                if (*p_ui_loop_loop == 8)
                {
                    *p_ui_loop += 1;
                    *p_ui_loop_loop = 1;
                }
            }
            else
            {
                frdbg("format incorrect\n");
                return FR_FAIL;
            }
        }

        p_st_fast->i_pre_define = FR_YES;
        switch (p_st_fast->i_operator)
        {
            case FIX_FAST_COPY_OPERATOR:
            case FIX_FAST_INCREMENT_OPERATOR:
            case FIX_FAST_DELTA_OPERATOR:
                /* 设置前值 */
                if (p_st_fast->p_pre_value)
                {
                    frfree(p_st_fast->p_pre_value);
                    p_st_fast->p_pre_value = NULL;
                }
                if (p_result_value)
                {
                    p_st_fast->p_pre_value = (char *)frmalloc(ui_result_size + 1);
                    if (p_st_fast->p_pre_value == NULL)
                    {
                        frfree(p_result_value);
                        return FR_FAIL;
                    }
                    memcpy(p_st_fast->p_pre_value, p_result_value, ui_result_size);
                    ((char *)p_st_fast->p_pre_value)[ui_result_size] = '\0';
                    p_st_fast->ui_pre_size = ui_result_size;
                }
                break;

            default:
                break;
        }

        ui64_count = 0;
        if (p_result_value)
        {
            /* 追加值到list中 */
            switch (p_st_fast->i_data_type)
            {
                case FIX_FAST_DATA_TP_INT32:
                    p_value = (char *)frmalloc(20);
                    memcpy(&i32_value, p_result_value, ui_result_size);
                    snprintf(p_value, 20, "%d", i32_value);
                    ui64_count = i32_value > 0 ? i32_value : 0;
                    frfree(p_result_value);
                    p_result_value = p_value;
                    break;

                case FIX_FAST_DATA_TP_UINT32:
                    p_value = (char *)frmalloc(20);
                    memcpy(&ui32_value, p_result_value, ui_result_size);
                    snprintf(p_value, 20, "%d", ui32_value);
                    ui64_count = ui32_value;
                    frfree(p_result_value);
                    p_result_value = p_value;
                    break;

                case FIX_FAST_DATA_TP_INT64:
                    p_value = (char *)frmalloc(20);
                    memcpy(&i64_value, p_result_value, ui_result_size);
                    snprintf(p_value, 20, "%ld", i64_value);
                    ui64_count = i64_value > 0 ? i64_value : 0;
                    frfree(p_result_value);
                    p_result_value = p_value;
                    break;

                case FIX_FAST_DATA_TP_UINT64:
                    p_value = (char *)frmalloc(12);
                    memcpy(&ui64_value, p_result_value, ui_result_size);
                    snprintf(p_value, 12, "%ld", ui64_value);
                    ui64_count = ui64_value;
                    frfree(p_result_value);
                    p_result_value = p_value;
                    break;

                default:
                    break;
            }

            p_st_data = (Fix_param *)frmalloc(sizeof(Fix_param));
            if (p_st_data == NULL)
            {
                frfree(p_result_value);
                return FR_FAIL;
            }
            p_st_node_new = frlist_node_create(p_st_data);
            if (p_st_node_new == NULL)
            {
                frfree((void *)p_st_data);
                frfree((void *)p_result_value);
                return FR_FAIL;
            }
            p_st_data->ui_tag = p_st_fast->i_id;

            switch (p_st_data->ui_tag)
            {
                case FIX_TAG_RAWDATA:
                    p_st_value = (Frbindata *)frmalloc(sizeof(Frbindata));
                    if (p_st_value == NULL)
                    {
                        frfree((void *)p_st_data);
                        frfree((void *)p_result_value);
                        return FR_FAIL;
                    }
                    p_st_data->field_value.p_st_value = p_st_value;
                    p_st_data->field_value.p_st_value->p_data = (char *)p_result_value;
                    p_st_data->field_value.p_st_value->ui_len = ui_result_size;
                    break;

                default:
                    p_st_data->field_value.p_value = (char *)p_result_value;
                    break;
            }
            p_result_value = NULL;

            frlist_push(p_lst_hd, p_st_node_new);

            /* fast.***.num....num */
            ui_tag_name_len = 5 + strlen(p_st_fast->p_name) + 1 + (ui_deep + 1) * (11 + 1 + 1) + 1;
            p_st_data->p_tag_name = (char *)frmalloc(ui_tag_name_len);
            if (p_st_data->p_tag_name == NULL)
            {
                return FR_FAIL;
            }
            snprintf(p_st_data->p_tag_name, ui_tag_name_len, "fast.%s", p_st_fast->p_name);
            ui_index = 0;
            while (ui_index <= ui_deep)
            {
                ui_tmp_len = strlen(p_st_data->p_tag_name);
                snprintf(p_st_data->p_tag_name + ui_tmp_len
                        , ui_tag_name_len - ui_tmp_len, ".%d"
                        ,  p_ui_deeps[ui_index++]);
            }

            if (p_st_fast->i_sub_node_flg && ui64_count)
            {
                while (ui64_count)
                {
                    ui_first_count = p_ui_deeps[ui_deep + 1] + 1;
                    memset(p_ui_deeps + ui_deep + 1, 0, 128 - ui_deep + 1);
                    p_ui_deeps[ui_deep + 1] = ui_first_count;

                    i_ret = fix_fast_parse_raw(pp_inbuff, p_ui_size
                                              , &p_st_fast->st_sub_node
                                              , p_lst_hd, p_ui_deeps
                                              , ui_deep + 1, p_pamp
                                              , ui_pmap_size, p_ui_loop
                                              , p_ui_loop_loop);
                    if (i_ret != FR_SUCC)
                    {
                        return FR_FAIL;
                    }
                    ui64_count--;
                }
            }
        }

        p_st_node = FRLIST_NEXT_NODE(p_st_node);
    }

    return FR_SUCC;
}

/*******************************************************************************
*  FUNC     :  解析pamp长度
*  ARGS     :  pp_inbuff (入力buffer)
*           :  p_ui_size (入力buffer size)
*           :  p_lst_mod (fast模板)
*           :  p_lst_hd (取得的值)
*  RTN      :  FR_FAIL      (FAIL)
*              FR_SUCC      (SUCC)
*  NOTE     :  todo OPIONAL null
*******************************************************************************/
int fix_fast_get_pamp(char **pp_inbuff
                      , unsigned int *p_ui_size
                      , unsigned int *p_ui_pmap_size)
{
    char *p_inbuff = *pp_inbuff;
    unsigned int ui_size = *p_ui_size;
    unsigned int ui_pmap_size = 0;

    /* 取得PMAP */
    while (ui_pmap_size < ui_size)
    {
        if (p_inbuff[ui_pmap_size++] & FIX_FAST_STOP_BIT)
        {
            break;
        }
    }

    /* 没有结束符 */
    if (ui_pmap_size == ui_size)
    {
        frdbg("There is no stop bit\n");
        return FR_FAIL;
    }

    *pp_inbuff += ui_pmap_size;
    *p_ui_size -= ui_pmap_size;
    *p_ui_pmap_size = ui_pmap_size;
    return FR_SUCC;
}
